<div id="gestion" class="row-fluid">
<div class="row-fluid">
<div class="span6 offset4">
<h1>Gestion des vidéos</h1>
</div>
</div>
<table class="row-fluid table table-hover">
	
	<tbody>
<?php
//----------------- TESTS --------------------//
$getsPasse=0;//TODO il va falloir regarder si on a des variables passées en get
// Récupération des themes
$themes= listeThemes();
if($getsPasse==1)
{
	$themePasse= "t01";//TODO à automatiser avec les passages de variables
	foreach($themes as $theme)
	{
		if($theme==$themePasse){
			afficheVideoTheme($theme);
		}
	}
}
else
{
	foreach($themes as $theme){
		afficheVideoTheme($theme);
		 
	}
}
function afficheVideoTheme($theme)
{
	 
	$videostheme = listeIDVideotheme($theme);
	// Ecriture de la liste des vidéos
	if ($videostheme != null && !empty($videostheme))
	{
		foreach( $videostheme as $video )
		{
			$nbExos=count(listeExercicesVideo($video));
			$nomVideo=nomVideo($video);
			$dateModif=dateModifVideo($video);
			$dateCrea=dateCreaVideo($video);
			$nomTheme=nomtheme($theme);
			$description=description($video);
			$difficulte=difficulte($video);
			echo "<tr id_video=\"" . $video . "\" nom_video=\"" . $nomVideo . "\">";
			echo "<td>".$nomVideo."</td>";
			echo '<td class="hidden-phone">'.$nomTheme.'</td>';
			echo '<td class="hidden-phone">'.$difficulte.'</td>';
			echo "<td>".$nbExos."</td>";
			echo '<td class="hidden-phone hidden-tablet">'.$dateCrea.'</td>';
			echo '<td class="hidden-phone hidden-tablet">'.$dateModif.'</td>';
			echo '<td class="hidden-phone">'.$description.'</td>';
			echo '<td class="btn-group">';
	        echo'<button class="btn btn-success modifier"><i class="icon-edit icon-white"></i></button>';
	        echo '<button class="btn btn-danger supprimer"><i class="icon-remove icon-white"></i></button></td>';
			echo "</tr>";
		}
	}
}
?>
	        </tbody>
	        <thead>
	            <tr>
	            <th>Nom</th>
	            <th class="hidden-phone">Thème</th>
	            <th class="hidden-phone">Difficulté</th>
	            <th><span class="hidden-phone">Nombre d'Exercices</span><span class="visible-phone">Exos</span></th>
	            <th class="hidden-phone hidden-tablet">Date de création</th>
	            <th class="hidden-phone hidden-tablet">Date de modification</th>
	            <th class="hidden-phone">Description</th>
	            <th>Actions</th>
	            </tr>
	</thead>
	    </table>
	    <div class="row-fluid">
	        <div class="span3">
	              <a href="./edit_video.php" class="btn btn-primary ">Ajouter une vidéo</a>
	        </div>
	    </div>
</div>

<script src="./javascript/gestion_video.js" type="text/javascript"></script>